package com.runtu.domain.activity.service.trial.Thread;



import com.runtu.domain.activity.adapter.repository.IActivityRepository;
import com.runtu.domain.activity.model.valobj.GroupBuyActivityDiscountVO;
import com.runtu.domain.activity.model.valobj.SCSkuActivityVO;

import java.util.concurrent.Callable;

/**
 * @author Fuzhengwei bugstack.cn @小傅哥
 * @description 查询营销配置任务
 * @create 2024-12-21 09:46
 */
public class QueryGroupBuyActivityDiscountVOThreadTask implements Callable<GroupBuyActivityDiscountVO> {

    /*来源*/
    private final String source;

    /*渠道*/
    private final String channel;

    /*商品ID*/
    private final String goodsId;

    /* 活动仓储*/
    private final IActivityRepository activityRepository;

    public QueryGroupBuyActivityDiscountVOThreadTask(String source, String channel, String goodsId,IActivityRepository activityRepository) {
        this.source = source;
        this.channel = channel;
        this.goodsId = goodsId;
        this.activityRepository = activityRepository;
    }

    @Override
    public GroupBuyActivityDiscountVO call() throws Exception {
        // 查询渠道商品活动配置关联配置
        SCSkuActivityVO scSkuActivityVO=activityRepository.querySCSkuActivityBySCGoodsId(source,channel,goodsId);
        if (null == scSkuActivityVO) return null;


        return activityRepository.queryGroupBuyActivityDiscountVO(scSkuActivityVO.getActivityId());
    }

}




